<?php
//对接首页商品列表发送ajax
header("content-type:text/html;charset=utf8");
//接收参数floor
$floor = $_GET['floor'];

$con = mysqli_connect('127.0.0.1','root','1997','bk2110',3306);
$res = mysqli_query($con,"select * from goods where isshowindex=$floor");
$arr = [];
//循环提取
while($row = mysqli_fetch_assoc($res)){
    $arr[] = $row;
}
if(count($arr)){
    echo json_encode([
        "meta"=>[
            "status"=>1,
            "msg"=>"数据获取成功"
        ],
        "data"=>$arr
    ]);
}else{
    echo json_encode([
        "meta"=>[
            "status"=>1,
            "msg"=>"数据获取成功"
        ],
        "data"=>null
    ]);
}